package utils;

import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

import java.io.InputStream;

public class MybatisUtil {
    static SqlSessionFactory factory;
    static {
        try {
            SqlSessionFactoryBuilder sqlSessionFactoryBuilder = new SqlSessionFactoryBuilder();

            InputStream is=MybatisUtil.class.getClassLoader().getResourceAsStream("mybatis-config.xml");

            factory=sqlSessionFactoryBuilder.build(is);
        }catch (Exception e){
            throw new RuntimeException(e);
        }
    }
}
